{extend name="base"}
{block name="title"}大联盟绑定成员查询{/block}
{block name="head"}
<style>
    a.input{
        margin: 1px;
        padding: 1px;
        display: inline-block;
        min-height:0;
        line-height:18px;
    }
    .border-table tbody th{text-align:center; color:#333; font-weight:400; padding-left:5px;}
    .border-table{font-size:12px; color:#666;}
    .border-table th, .border-table td{padding:0 4px;}
</style>
{/block}
{block name="body"}
<body class="mainbody">
<form>
    <input type="hidden" name="code1" value="{$code1}">
    <!--导航栏-->
    <div class="location">
        <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
        <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
        <i class="arrow iconfont icon-arrow-right"></i>
        <span>大联盟绑定成员查询</span>
    </div>
    <!--/导航栏-->

    <!--工具栏-->
    <div id="floatHead" class="toolbar-wrap">
        <div class="toolbar">
            <div class="box-wrap">
                <a class="menu-btn"><i class="iconfont icon-more"></i></a>

                <div class="l-list">
                    <div class="menu-list">
                        <div class="rule-single-select">
                            <select name="channel" style="display:none">
                                <option value="-1">所有渠道</option>
                                {volist name="CHANNELS" id="val"}
                                <option value="{$key}"{eq name="channel" value="$key"} selected{/eq}>[{$key}]{$val.Name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="rule-single-select">
                            <select name="kind" style="display:none">
                                <option value="-1">所有游戏</option>
                                {volist name="GAME_KIND" id="val"}
                                <option value="{$key}"{eq name="kind" value="$key"} selected{/eq}>[{$key}]{$val}</option>
                                {/volist}
                            </select>
                        </div>

                        <div class="rule-single-select">
                            <select name="black" style="display:none">
                                <option value="-1">是否黑名单</option>
                                <option value="0"{eq name="black" value="0"} selected{/eq}>[0]否</option>
                                <option value="1"{eq name="black" value="1"} selected{/eq}>[1]是</option>
                            </select>
                        </div>

                        <input type="text" class="input txt" autocomplete="off" name="search" value="{$search|default=''|htmlentities}" placeholder="UserID/GameID/昵称" />

                        <input type="text" class="input small" autocomplete="off" name="code2" value="{$code2|default=''|htmlentities}" placeholder="代理GameID" />
                        <input type="text" class="input small" autocomplete="off" name="code3" value="{$code3|default=''|htmlentities}" placeholder="群主GameID" />
                        <input type="text" class="input small" autocomplete="off" name="code4" value="{$code4|default=''|htmlentities}" placeholder="群号" />
                        <a class="btn-search"><i class="iconfont icon-search"></i></a>
                    </div>
                </div>
                <div class="r-list">
                    <label style="color:#f00;">合计房卡：{$waste|default=0|number_format}</label>
                </div>
            </div>
        </div>
    </div>
    <!--/工具栏-->

    <!--列表-->
    <div class="table-container">
        <table class="border-table ltable">
            <tr>

                <th>#</th>
                <th>渠道</th>
                <th>游戏</th>
                <th>群号</th>
                <th>大联盟货币</th>
                <th>玩家/头像/昵称/GameID</th>
                <th>所属推广员</th>
                <th>所属群主</th>
                <th>绑定日期</th>
                <th>更新日期</th>
                <th width="60">操作</th>
            </tr>
            {empty name="list"}
            <tr><td colspan="11">Oh~暂无数据!</td></tr>
            {else}
            {volist name="list" id="v"}
            <tr data-id="{$v.ID}" data-gid="{$v.GameID}" data-fid="{$v.Code}">

                <td{eq name="$v.IsBlack" value="1"} style="color:#fff; background:#7F7F7F;"{/eq}>{$v.ID}</td>
                <td>[{$v.Channel}]{$CHANNELS[$v.Channel]['Name'] ?? '--'}</td>
                {if condition="$v.FamilyType eq 1"}
                <td>[房卡场].[{$v.KindID}]{$GAME_KIND[$v.KindID] ?? '--'} </td>
                {elseif condition="$v.FamilyType eq 2"/}
                <td>[金币场].[{$v.KindID}]{$GAME_KIND[$v.KindID] ?? '--'} </td>
                {else/}
                <td>[{$v.KindID}]{$GAME_KIND[$v.KindID] ?? '--'}</td>
                {/if}
                <td><a target="_blank" href="{:url('family')}?code1={$v.Code}">{$v.Code}</a></td>
                <td>{eq name="v.IsPass" value="1"}<a class="input d">{$v.Gold}</a>{else/}{$v.Gold}{/eq}</td>
                <td class="user-avatar" title="
游戏帐号：{$v.Accounts}&#13
真实姓名：{$v.Compellation}&#13
用户标识：{$v.UserID}&#13
手机号码：{$v.RegisterMobile}&#13
    性别：{switch name='$v.Sex'}{case value='1'}男性{/case}{case value='2'}女性{/case}{/switch}&#13
注册时间：{$v.RegisterDate}&#13
注册地址：{$v.RegisterIP}&#13;
登录次数：{$v.GameLogonCount} 次&#13
最后登录时间：{$v.LastLogonDate}&#13
最后登录地址：{$v.LastLogonIP}&#13
"{eq name="$v.UserRight" value="64"} style="background:{$v.IsBoss?'#FFC5A8':'#FFDBC8'}"{/eq}>
                <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.UserID}">
                    <img src="{$v.Avatar?:'__STATIC__/houtai/images/dface.png'}" />
                </a>
                <div class="user-box">
                    <h4><a target="_blank" class="at_{$v.AccountsType}" href="{:url('user.detail/index')}?UserID={$v.UserID}">{:htmlentities($v.NickName)}</a></h4>
                    <i>{$v.GameID}</i>
                </div>
                </td>
                <td class="user-avatar"><!-- 所属推广员 -->
                    {gt name="v.AUserID" value="0"}
                    <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.AUserID}">
                        <img src="{$v.AAvatar?:'__STATIC__/houtai/images/dface.png'}" />
                    </a>
                    <div class="user-box">
                        <h4><a target="_blank" class="at_{$v.AAccountsType}" href="{:url('user.detail/index')}?UserID={$v.AUserID}">{$v.ACompellation}</a></h4>
                        <i>{$v.AGameID}</i>
                    </div>
                    {/gt}
                </td>
                <td class="user-avatar"><!-- 所属群主 -->
                    {gt name="v.FUserID" value="0"}
                    <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.FUserID}">
                        <img src="{$v.FAvatar?:'__STATIC__/houtai/images/dface.png'}" />
                    </a>
                    <div class="user-box">
                        <h4><a target="_blank" class="at_{$v.FAccountsType}" href="{:url('user.detail/index')}?UserID={$v.FUserID}">{$v.FCompellation}</a></h4>
                        <i>{$v.FGameID}</i>
                    </div>
                    {/gt}
                </td>
                <td>{$v.CreateTime}</td>
                <td>{$v.UpdateTime}</td>
                <td>
                    {eq name="v.IsPass" value="1"}
                    <a class="input a">删除绑定</a>
                    <a class="input b">设置属性</a>
                    {else/}
                    <a class="input c">确认审核</a>
                    {/eq}
                </td>
            </tr>
            {/volist}
            {/empty}
        </table>
    </div>
    <!--/列表-->

    <!--内容底部-->
    <div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>
    <!--/内容底部-->

</form>
<script>
    $(function () {
//反选
        $("#checkAll").on("click",function(){

            $("[name='checkbox']").each(function(){
                //遍历所有复选框，然后取值进行 !非操作
                $(this).prop("checked", !$(this).prop("checked"));
            })
        });
        //解除绑定
        $('table.ltable a.a').click(function () {
            var id = $(this).parents('tr').data('id')
            console.log("删除绑定", id);
            dialog({
                title: '提示',
                content: '是否删除该绑定?',
                okValue: '确定',
                ok: function () {
                    $.post("{:url('MemberDelete')}?id=" + id, function (resp, text, xhr) {
                        console.log(resp);
                        if (resp.errno == 0) {
                            location.reload();
                        } else {
                            alert(resp.error);
                        }
                    });
                    return false;
                },
                cancelValue: '取消',
                cancel: function () {}
            }).showModal();
        });
        //设置属性
        $('table.ltable a.b').click(function () {
            var id = $(this).parents('tr').data('id');
            console.log("属性", id);
            var url = "{:url('user.family/mright')}?id=" + id+"&type=2";
            dialog({
                title: '绑定属性[' + id + ']',
                url: url,
                width: 500,
                height: 300,
                okValue: '确认提交',
                ok: function () {
                    var f = $('iframe', this.node);
                    var v = $('input', f.contents()).serialize();
                    console.log(v);
                    $.post(url, v, function (resp, state, xhr) {
                        console.log(resp);
                        alert(resp.error);
                        if (resp.errno == 0) {
                            location.reload();
                        }
                    });
                    return false;
                }
            }).showModal();
        });


        $('table.ltable a.c').click(function () {
            var tr = $(this).parents('tr');
            var id = tr.data('id');
            var fid = tr.data('fid');
            var gid = tr.data('gid');
            console.log('确认用户[' + gid + ']加入群[' + fid + ']?');
            dialog({
                title: '提示',
                content: '确认用户[' + gid + ']加入群[' + fid + ']?',
                okValue: '确定',
                ok: function () {
                    $.post("{:url('agreem')}?id=" + id, function (resp, text, xhr) {
                        console.log(resp);
                        if (resp.errno == 0) {
                            location.reload();
                        } else {
                            alert(resp.error);
                        }
                    });
                    return false;
                },
                cancelValue: '取消',
                cancel: function () {}
            }).showModal();
        });

        $('table.ltable a.d').click(function () {
            var tr = $(this).parents('tr');
            var id = tr.data('id');
            var gid = tr.data('gid');
            dialog({
                title: '赠送群货币给玩家[' + gid + ']',
                content: '<input type="text" class="input" placeholder="请输入要赠送的群货币" />',
                okValue: '确定',
                cancelValue: '取消',
                cancel: function () {},
                ok: function () {
                    var a = $(this.node);
                    var p = $('.input', a);
                    var v = p.val();
                    console.log(v);
                    $.post("{:url('zengGold')}", {id: id, gold: v}, function (resp, text, xhr) {
                        console.log(resp);
                        alert(resp.error);
                        if (resp.errno == 0) {
                            location.reload();
                        }
                    });
                    return false;
                }
            }).showModal();
        });
    });
</script>
</body>
{/block}